<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>${SYSTEM_NAME}</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/layuiadmin/layui/css/layui.css?v=${FILE_VERSION}" media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/layuiadmin/style/admin.css?v=${FILE_VERSION}" media="all">
</head>
<body>
	<input id="tableId" type="hidden" value="${tableId}">
	<div class="layui-fluid">
       	<div class="layui-card">
         	<div class="layui-card-header">代码生成器列管理</div>
         	<div class="layui-card-body">
         		<div class="layui-form layer-query">
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">列名：</label>
							<div class="layui-input-inline">
								<input type="text" id="columnName" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<button class="layui-btn layui-btn-primary layui-border-blue" onclick="reload()">查询</button>
						</div>
					</div>
				</div>
         		<hr class="layui-bg-green">
           		<table class="layui-table" lay-filter="tableList" id="layerTable">
				</table>
         	</div>
       	</div>
  	</div>

	<script type="text/html" id="barTpl">
		<a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs" lay-event="edit">编辑</a>
		<a class="layui-btn layui-btn-primary layui-border-red layui-btn-xs" lay-event="del">删除</a>
	</script>

	<script src="${pageContext.request.contextPath}/static/js/common-2.0.0.js?v=${FILE_VERSION}"></script>
  	<script src="${pageContext.request.contextPath}/static/layuiadmin/layui/layui.js?v=${FILE_VERSION}"></script>
  	<script src="${pageContext.request.contextPath}/static/js/jquery-3.3.1.min.js?v=${FILE_VERSION}"></script>
	<script src="${pageContext.request.contextPath}/static/js/common/core-2.0.0.js?v=${FILE_VERSION}"></script>
  	<script>
  		var table;
	  	layui.use(['table', 'element'], function() {
			table = layui.table;
			table.render({ 
				elem : '#layerTable',
				even : "true",
				id : 'tableList',
				height: 'full-200',
				url : getContextPath() + '/generator/field/list/listInfoNoPage',
				page : false,
				method : 'post',
				where : {
					"tableId" :$("#tableId").val()
				},
				cols : [[
					{field : 'columnName',minWidth : 120,title : "列名称"}
					,{field : 'columnType',width : 120,title : "列类型"}
					,{field : 'columnLength1',width : 90,title : "字段长度1"}
					,{field : 'columnLength2',width : 90,title : "字段长度2"}
					,{field : 'columnComment',width : 100,title : "字段注释"}
					,{field : 'fieldName',width : 100,title : "字段名称"}
					,{field : 'fieldType',width : 90,title : "字段类型"}
					,{field : 'inputTypeName',width : 110,title : "输入框类型"}
					,{field : 'requiredName',width : 110,title : "输入框必填"}
					,{field : 'listShowName',width : 120,title : "LIST是否显示"}
					,{field : 'paramName',width : 120,title : "系统参数名称"}
					,{field : 'isQueryName',width : 80,title : "查询列"}
					,{fixed: 'right', width:180, align:'center',title:"操作", toolbar: '#barTpl'}
				]]
			//如果无需自定义请求参数，可不加该参数
			});

			//监听工具条
			table.on('tool(tableList)', function(obj) {
				var data = obj.data;
				if (obj.event === 'del') {
					deleteById(data,obj,'/generator/field/del/deleteById');
				} else if (obj.event === 'edit') {
					addLayer('/generator/field/edit/input', data.id);
				}
			});
		});

		function reload() {
			table.reload('tableList', {
				where : {
					"tableId" :$("#tableId").val(),
					"columnName" : $("#columnName").val()
				}
			});
		}

  	</script>
</body>
</html>
